#pragma once
#include "HTTPCloseEnum.h"
#include "HTTPMethod.h"
/**
 * 服务状态信息接口
 * HTTP服务器在运行期间会调用这个接口的方法以使该接口的实现可以获取时时的HTTP服务器
 */
class IHTTPServerStatusHandler
{
public:
	
	//新连接生成是否响应，由参数 bRefused 标识是否被服务器拒绝.
	virtual void onNewConnection(const char * ip, unsigned int port, bool bRefused, bool kicked) = 0;

	virtual void onCloseConnection(const char * ip, unsigned int port, HTTP_CLOSE_STATUS status) = 0;

	//处理客户端请求，发送数据给客户端前调用的方法
	virtual void onRequestBegin(const char *ip, unsigned int port, unsigned char * url, HTTPMethod method) = 0;

	virtual void onRequestEnd(const char *ip, unsigned int port, const char *url, int svrCode, __int64 bytesSent, __int64 bytesRecved, unsigned int timeUsed, bool completed) = 0;

	//数据发送完成时调用
	virtual void  onDataSend(const char *ip, unsigned int port, unsigned int byteSendNumber) = 0;
	virtual void  onDataReceived(const char *ip, unsigned int port, unsigned int byteReceiveNumber) = 0;
};